using System;
using System.Collections.Generic;
using System.Text;

namespace Logging
{
    public class Level
    {

        private static Dictionary<string, Level> levels = new Dictionary<string, Level>();

        public static Level OFF = new Level("Off", int.MaxValue);
        public static Level SEVERE = new Level("Severe", 1000);
        public static Level WARNING = new Level("Warning", 900);
        public static Level INFO = new Level("Info", 800);
        public static Level CONFIG = new Level("Config", 700);
        public static Level FINE = new Level("Fine", 500);
        public static Level FINER = new Level("Finer", 400);
        public static Level FINEST = new Level("Finest", 300);
        public static Level ALL = new Level("All", int.MinValue);

        public static Level Parse(string name)
        {
            return levels[name];
        }

        private string name;
        private int value;
        private string resourceBundleName;

        public Level(string name, int value)
        {
            this.name = name;
            this.value = value;
            levels.Add(name, this);
        }

        public Level(string name, int value, string resourceBundleName)
        {
            this.name = name;
            this.value = value;
            this.resourceBundleName = resourceBundleName;
            levels.Add(name, this);
        }

        public string Name
        {
            get { return name; }
        }

        public int Value
        {
            get { return value; }
        }

        public string RessourceBundleName
        {
            get { return resourceBundleName; }
        }

    }
}
